
<%@page import="Entity.Category"%>
<%@page import="Entity.Event"%>
<%@page import="Entity.Account"%>
<%
            if ((session.getAttribute("Admin_Session") == null)||(session.getAttribute("User_Session") != null))
            {
                response.sendRedirect(request.getContextPath() + "/index.jsp");
            } else {
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>National Level Paper Presentation</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<link href="css/white/style.css" media="screen" title="shadow" rel="stylesheet" type="text/css" />
<link href="css/demo_table.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" language="javascript" src="js/jquery.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.dataTables.js"></script>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/piroBox.1_2.js"></script>
<script type="text/javascript" src="js/jquery.validate.min.js"></script>
<script>
	$.noConflict();
</script>
<script type="text/javascript" charset="utf-8">
			$(document).ready(function() {
				$('#TableCategory').dataTable( {
					"aaSorting": [[ 4, "desc" ]]
				} );
			} );
</script>

</head>
<body>

<div id="templatemo_body_wrapper">
<div id="templatemo_wrapper">

	<div id="tempaltemo_header">
    	<div id="header_content">
		</div>
    </div> <!-- end of header -->

    <div id="templatemo_main_top"></div>
    <div id="templatemo_main">

        <div id="templatemo_sidebar">

        	<div id="templatemo_menu">
<%
        if(session.getAttribute("Admin_Session")!=null)
            {

            Account ac = (Account)session.getAttribute("Admin_Session");

%>
<table>
    <tr>
            <%
                   if(ac.getAvatar()!=null)
                       {
            %>
                  <td><img class="avatarAdmin" src="images/avatar/<%= ac.getAvatar() %>"/></td>
            <%
                        }else{
            %>
                  <td><img class="avatarAdmin" src="images/avatar/avatar.jpg"/></td>
            <%
                        }
             %>
    </tr>
    <tr>
        <td align="center"><strong>Information</strong></td>

    </tr>
    <tr>
<%
        if(ac.getGender().equals("Male"))
            {
%>
    <td>Mr:</td>
<%
       }else
        {
%>
    <td>Ms:</td>
<%
        }
%>
<td><%= ac.getFullname() %></td>
    </tr>
    <tr>
        <td>Address: </td>
	<td><%= ac.getAddress() %></td>
    </tr>
    <tr>
        <td><a href="ADUpdateProfile.jsp">More Profile</a></td>
	<form action="LoginServlet" method="post">
            <td><input type="submit" name="action" value="Sign Out" class="Button"/> </td>
        </form>
    </tr>
</table>
<%}%>
<br/>
<br/>
                    <ul>
                    <ul>
                    <li><a href="AdminHome.jsp" target="_parent">Home</a></li>
                    <li><a href="MinhNHServlet?action=AdviewAccount" target="_parent">Manage Account</a></li>
                    <li><a href="VietDQServlet?action=GetAllEvents" target="_parent">Manage Events</a></li>
                    <li><a href="PhuocPHServlet?action=GetListCate" target="_parent" class="current">Manage Category</a></li>
                    <li><a href="VietDQServlet?action=AdviewFAQ" target="_parent">Manage FAQ</a></li>
                    <li><a href="PhuocPHServlet?action=ManageFB" target="_parent">Manage FeedBack</a></li>
                    <li><a href="PhuocPHServlet?action=manageComment" target="_parent">Manage Comment</a></li>
              </ul>
              </ul>
            </div> <!-- end of templatemo_menu -->
            <div class="cleaner"></div>
        </div> <!-- end of sidebar -->

        <div id="templatemo_content">

            <div class="content_box">
                    <h2>MANAGE CATEGORY</h2>
              <div class="cleaner h30"></div>
              <h15>Add New</h15>

            <form action="PhuocPHServlet" method="post" id="Add_Category">
            		<table>
                  <tr>
                    <td>Category Name:</td>
                    <td ><input type="text" name="txtCateName" id="txtCateName"/>(<span class="style1">*</span>)</td>
                    <td><label for="txtCateName" generated="true" class="error"></label></td>
                  </tr>
                  <tr>
               
                <td><input name="action" type="submit" value="Add New" class="Button"/></td>
                <td><input name="reset" type="reset" value="Reset" class="Button"/></td> 
                  <td></td>
                  </tr>
			</table>

            </form>
          
                <div class="cleaner h30"></div>
 <%
          if(session.getAttribute("List_Category")==null)
              {
                // request.getRequestDispatcher("").forward(request, response);
              }else
                  {
%>
              <table cellpadding="0" cellspacing="0" class="display" id="TableCategory">
	<thead>
		<tr>
			<th>Category Name</th>
             <th>Status</th>
            <th>Control</th>
		</tr>
	</thead>
	<tbody>
            <%
                    String Strstatus = "Avaiable";
                    Category[] resultCate = (Category[])session.getAttribute("List_Category");
                       for (int i = 0; i < resultCate.length; i++) {
                               if(resultCate[i].getIDelete())
                                 {
                                    Strstatus = "Unavaiable";
                                 }
                                             
            %>
                <tr class="gradeC">
                    <td><a href="PhuocPHServlet?action=Edit&Cate_ID=<%= resultCate[i].getCaID() %>" ><%= resultCate[i].getCaName() %></a></td>
                    <td><%= Strstatus %></td>
                    <td bgcolor="#EEEEEE" align="center" >
                        <a href="PhuocPHServlet?action=Edit&Cate_ID=<%= resultCate[i].getCaID() %>"><img height="20" width="20" src="images/write.png" /></a>
                        <a onclick="return confirm('Are you sure Delete ?')" href="PhuocPHServlet?action=Delete&Cate_ID=<%= resultCate[i].getCaID() %>"><img height="20" width="20" src="images/icon_remove.png" /></a>
                    </td>
                </tr>
<%
        }
%>
	</tbody>
	<tfoot>
		<tr>
			<th>Category Name</th>
                        <th>Status</th>
                        <th>Control</th>
		</tr>
	</tfoot>
</table>
<%
        }
%>

          </div>

        </div>
           <script type="text/javascript">
    jQuery(document).ready(function($) {
           $("#Add_Category").validate({
             messages: {
                 txtCateName: {
                     required: "Category name is required",
                     rangelength: "Category name must be from 6 to 15 characters"
                 }
            },
            rules: {
                txtCateName: {
                    required: true,
                    rangelength: [6, 15]
                 }
            }
        });
    });
         $(".cancel").click(function() {
		validator.resetForm();
	});

 </script>

        <div class="cleaner"></div>
    </div>

    <div id="templatemo_main_bottom">
    </div>

</div> <!-- end of wrapper -->
</div>

<div id="templatemo_footer_wrapper">
	<div id="templatemo_footer">
        Copyright © 2012 <a href="#">KSC Technology and Sciences</a> |
                Designed by <a href="#">Group_05_F2-1104-T1_FAT2_FPT-Aptech</a>

    </div>
</div>

</body>
</html>
<%
    }
%>